package ls.dom4j.erp.student.service.impl;

import ls.dom4j.erp.student.dao.StudentDao;
import ls.dom4j.erp.student.dao.impl.StudentDaoImpl;
import ls.dom4j.erp.student.entity.StudentEntity;
import ls.dom4j.erp.student.service.StudentService;

/**
 * service 层调用dao层
 * 
 * 套路：增加一个属性（接口） private
 * 赋值：接口的实现类
 * @author My
 *
 */
public class StudentServiceImpl implements StudentService {
	
	private StudentDao studentDao=new StudentDaoImpl();
	

	@Override
	public void add(StudentEntity entity) throws Exception {
		
		//1 在增加之前要判断这个对象是否已经存在... 遍历指定的xml里面去 根据id去判断
		studentDao.add(entity);
		
	}


	@Override
	public void deleteByName(String studentName) throws Exception {
		studentDao.deleteByname(studentName);
	}


	@Override
	public void update(int id, String name) throws Exception {

		studentDao.update(id, name);
	}
	
	

}
